package com.yhyl;

import com.yhyl.domain.Student;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;

@SpringBootTest
public class RedisTest1 {
    @Autowired
    private RedisTemplate<Object,Object> redisTemplate;

    @Test
    public void TestObj(){
        Student student = new Student();
        student.setAge(18);
        student.setName("yhyl");
        redisTemplate.opsForValue().set("student",student);
    }
    @Test
    public void TestString(){
        Student student = (Student) redisTemplate.opsForValue().get("student");
        System.out.println(student);
    }
}
